package com.example.utils;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.material.snackbar.Snackbar;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link inneViewPagerFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class inneViewPagerFragment extends Fragment {

    View view;
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    // TODO: Rename and change types of parameters
    private String mParam1;
    public inneViewPagerFragment() {
        // Required empty public constructor
    }

    /**
     * Use this factory method to create a new instance of
     * this fragment using the provided parameters.
     *
     * @param param1 Parameter 1.
     * @return A new instance of fragment inneViewPagerFragment.
     */
    // TODO: Rename and change types and number of parameters
    public static inneViewPagerFragment newInstance(String param1) {
        inneViewPagerFragment fragment = new inneViewPagerFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = inneViewPagerFragment.this.getArguments();
        String message = bundle.getString("message");
        Log.d("TAG", "onCreate: "+message);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (view == null){
            view = inflater.inflate(R.layout.fragment_inne_view_pager, container, false);
        }
        TextView textView = view.findViewById(R.id.fragmentContent);
        textView.setText(mParam1);
        return view;

    }
}